package com.bootdo.common.task;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Component;

import com.bootdo.hjh.cache.MemberCache;
import com.bootdo.oa.domain.Response;

@Component
public class CashJob implements Job{
	
	private static final Logger LOGGER = LoggerFactory.getLogger(CashJob.class);
	@Autowired
	SimpMessagingTemplate template;
	@Autowired
	private MemberCache memberCache;

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
    		memberCache.reloadCacheFromDb();
    		LOGGER.info("刷新缓存结束");
    		template.convertAndSend("/topic/getResponse", new Response("用户缓存刷新完毕" ));
    }

}